package com.fernandomartines.dbcheck.util;

import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;

public class ScreenUtil {

    private ScreenUtil() {

    }

    public static void setWaitCursor(Component component) {
        component.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    }

    public static void setDefaultCursor(Component component) {
        component.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }

    public static void centralizeFrame(JFrame frame) {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation((screenSize.width - frame.getWidth()) / 2, (screenSize.height - frame.getHeight()) / 2);
    }

    public static void sleep(int ms) {
        try {
            Thread.sleep(ms);
        } catch (Exception e) {
        }
    }

}
